//https://leetcode.cn/problems/single-number-ii/
class Solution {
    public int singleNumber(int[] nums) {
        int ret = 0;
        for(int x = 0; x <32; x++) {
            int bitSum = 0;
            for(int n : nums) {
                bitSum += (n >> x) & 1;
            }
            //bit %= n;
            bitSum %= 3;
            ret |= (bitSum << x);
        }
        return ret;
    }
}